import { Column, PrimaryGeneratedColumn } from "typeorm";
import { EntityModel } from "@midwayjs/orm";

@EntityModel("certificate", { schema: "heart_neighbor" })
export class Certificate {
  @PrimaryGeneratedColumn({ type: "int", name: "id", comment: "Primary Key" })
  id!: number;

  @Column("datetime", {
    name: "create_time",
    nullable: true,
    comment: "Create Time",
    default: () => "CURRENT_TIMESTAMP",
  })
  createTime!: Date | null;

  @Column("varchar", {
    name: "name",
    nullable: true,
    comment: "证书名称",
    length: 255,
  })
  name!: string | null;

  @Column("tinyint", {
    name: "type",
    nullable: true,
    comment: "证书类型，1=帮扶证书，2=捐赠证书",
    width: 1,
    default: () => "'1'",
  })
  type!: boolean | null;

  @Column("varchar",{
    name: 'org',
    nullable: true,
    comment: "证书所属机构",
    length: 255
  })
  org!: string | null;

  @Column("varchar", {
    name: "condition",
    nullable: true,
    comment: "证书条件",
    length: 255,
  })
  condition!: string | null;
}
